package cn.fl.ref.fncprjpaysch.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.cmm.base.framework.exception.BaseException;
import cn.fl.ref.fncprjpaysch.service.IFncPrjPaySchDJrnlService;
import cn.fl.ref.fncprjpaysch.transform.FncPrjPaySchDJrnlVOTransform;
import cn.fl.ref.fncprjpaysch.vo.FncPrjPaySchDJrnlVO;
import fl.ref.fncprjpaysch.condition.FncPrjPaySchDJrnlCondition;
import fl.ref.fncprjpaysch.dto.FncPrjPaySchDJrnlDTO;
import fl.ref.fncprjpaysch.service.IFncPrjPaySchDJrnlApiService;

@Service
public class FncPrjPaySchDJrnlServiceImpl implements IFncPrjPaySchDJrnlService {
	@Autowired
	private IFncPrjPaySchDJrnlApiService fncPrjPaySchDJrnlApiService;
	
	@Override
	public Long add(FncPrjPaySchDJrnlVO vo) throws BaseException {
		return fncPrjPaySchDJrnlApiService.add(FncPrjPaySchDJrnlVOTransform.toDTO(vo));
	}

	@Override
	public boolean modify(FncPrjPaySchDJrnlVO vo) throws BaseException {
		return fncPrjPaySchDJrnlApiService.update(FncPrjPaySchDJrnlVOTransform.toDTO(vo));
	}

	@Override
	public FncPrjPaySchDJrnlVO selectById(Long id) throws BaseException {
		return FncPrjPaySchDJrnlVOTransform.toVO(fncPrjPaySchDJrnlApiService.selectById(id));
	}

	@Override
	public List<FncPrjPaySchDJrnlVO> selectList(FncPrjPaySchDJrnlCondition condition) throws BaseException {
		return FncPrjPaySchDJrnlVOTransform.toVOList(fncPrjPaySchDJrnlApiService.searchList(condition));
	}

	@Override
	public Long batchUpdateJrnlRepayDetl(List<FncPrjPaySchDJrnlVO> detail) throws BaseException {
		List<FncPrjPaySchDJrnlDTO> entity = FncPrjPaySchDJrnlVOTransform.toDTOList(detail);
		fncPrjPaySchDJrnlApiService.batchUpdateJrnlRepayDetl(entity);
		return null;
	}

	@Override
	public List<FncPrjPaySchDJrnlVO> selectJrnlRepayDetlLst(Long jrnlMId) throws BaseException {
		List<FncPrjPaySchDJrnlDTO> dtoLst = fncPrjPaySchDJrnlApiService.selectJrnlRepayDetlLst(jrnlMId);
		List<FncPrjPaySchDJrnlVO> voLst = FncPrjPaySchDJrnlVOTransform.toVOList(dtoLst);
		return voLst;
	}

	@Override
	public List<Map<String, Object>> selectRepayCost0Lst(Long jrnlMId) throws BaseException {
		return fncPrjPaySchDJrnlApiService.selectRepayCost0Lst(jrnlMId);
	}

	@Override
	public List<Map<String, Object>> selectJrnlRepayAllLst(Long jrnlMId)
			throws BaseException {
		// TODO Auto-generated method stub
		return fncPrjPaySchDJrnlApiService.selectJrnlRepayAllLst(jrnlMId);
	}

}
